<template>
  <div class="tab">
    <router-link tag="div" class="tab-item" to="/recommend">
      <span class="tab-link">推荐</span>
    </router-link>
    <router-link tag="div" class="tab-item" to="/singer">
      <span class="tab-link">歌手</span>
    </router-link>
    <router-link tag="div" class="tab-item" to="/rank">
      <span class="tab-link">排行</span>
    </router-link>
    <router-link tab="div" class="tab-item" to="/search">
      <span class="tab-link">搜索</span>
    </router-link>
  </div>
</template>

<script>
  export default {
    name: 'tab',
    data () {
      return {}
    }
  }
</script>

<style lang="scss" scoped>
  /* ref https://segmentfault.com/a/1190000006628546?name=Webpack&description=&isPrivate=1
     在路径前加波浪线，编译时才会去 webpack 的 alias 里面找匹配项。
     详见 https://github.com/webpack/loader-utils#module-urls。
     补充，该方法同样适用于 css 文件中的 background: url(~imgModule/xxx.png') 中的 url. */
  @import "~common/sass/variable";

  .tab {
    display: flex;
    height: 44px;
    line-height: 44px;
    font-size: $font-size-medium;
    .tab-item {
      flex: 1;
      text-align: center;
      .tab-link {
        padding-bottom: 5px;
        color: $color-text-l;
      }
      &.router-link-active {
        .tab-link {
          color: $color-theme;
          border-bottom: 2px solid $color-theme;
        }
      }
    }
  }
</style>